import 'package:chat_shop/common/const/cosnt.dart';
import 'package:chat_shop/common/widget/alert.dart';
import 'package:chat_shop/common/widget/bottom_btn.dart';
import 'package:chat_shop/login&regist/view/alert_login_view.dart';
import 'package:flutter/material.dart';

class LoginPage extends StatelessWidget {
  /// 0 手机登录 1 邮箱登录 2 注册
  void _alert(BuildContext context, int status) {
    Alert.showBottomViewDialog(
      context,
      AlertLoginView(
        status: status,
        title: status < 2 ? "登录" : "注册",
      ),
    );
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        backgroundColor: Colors.black,
        body: SafeArea(
          child: Container(
            width: double.infinity,
            child: Column(
              children: [
                Expanded(
                    child: Image.network(
                        "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fen.pimg.jp%2F046%2F365%2F376%2F1%2F46365376.jpg&refer=http%3A%2F%2Fen.pimg.jp&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1673083737&t=a9b29bb43f0ea93db54592e66cba7d8d")),
                Padding(
                  padding: const EdgeInsets.symmetric(horizontal: 21),
                  child: Row(
                    children: [
                      Expanded(
                          child: BottomButton(
                        title: "手机",
                        margin: EdgeInsets.zero,
                        onTap: () => _alert(context, 0),
                      )),
                      SizedBox(
                        width: 20,
                      ),
                      Expanded(
                          child: BottomButton(
                        title: "邮箱",
                        bgColor: Colors.white,
                        onTap: () => _alert(context, 1),
                        fontColor: Colors.black26,
                        margin: EdgeInsets.zero,
                      ))
                    ],
                  ),
                ),
                InkWell(
                  onTap: () => _alert(context, 2),
                  child: Container(
                    height: 50,
                    width: double.infinity,
                    alignment: Alignment.center,
                    margin: const EdgeInsets.only(left: 21, right: 21, top: 20, bottom: 80),
                    decoration: BoxDecoration(
                        border: Border.all(width: 1, color: Colors.white), borderRadius: BorderRadius.circular(3)),
                    child: Text(
                      "还没有账号？立即注册",
                      style: AppFont.textStyle(15, color: Colors.white),
                    ),
                  ),
                ),
              ],
            ),
          ),
        ));
  }
}
